import Vue from 'vue'
import Router from 'vue-router'
Vue.use(Router)


const router = new Router({
  mode: 'history',
  routes: [
    {
      path: '/category',
      name: 'category',
      meta: {
        title: '分类页'
      },
      component: resolve => require(['@/views/index/category.vue'], resolve)
    },
    {
      path: '/list',
      name: 'list',
      meta: {
        title: '列表页'
      },
      component: resolve => require(['@/views/index/list.vue'], resolve)
    },
    {
      path: '/detail',
      name: 'detail',
      meta: {
        title: '列表页'
      },
      component: resolve => require(['@/views/index/detail.vue'], resolve)
    },
  ]
})


router.afterEach((to, from) => {
  window.scrollTo(0, 0)
})

export default router